﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="user.aspx.cs" Inherits="Quantringuoidung_user" Title="Untitled Page" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

        <!-- content start -->
        
      
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">
            function RowDblClick(sender, eventArgs)
            {
              sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
            </script>

        </telerik:RadCodeBlock>

               
        
            <p id="divMsgs" runat="server">
        <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>
        <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>
            </p>
      
         <!-- load ajax-->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid_congxa">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid_congxa" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="divMsgs" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        <!-- end-->
        
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
        <telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True"
            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowPaging="True"
            AutoGenerateColumns="False"  DataSourceID="SessionDataSource1" OnItemUpdated="RadGrid1_ItemUpdated"
            OnItemDeleted="RadGrid1_ItemDeleted" 
           OnItemInserted="RadGrid1_ItemInserted" OnDataBound="RadGrid1_DataBound" 
           AllowSorting="True" CellSpacing="0">
            <PagerStyle Mode="NextPrevAndNumeric" />


            <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="Username"
                 DataSourceID="SessionDataSource1" HorizontalAlign="NotSet" 
                AutoGenerateColumns="False">
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>

                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
                 <Columns>
                
                     <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="Username" HeaderText="Username" SortExpression="Username"
                        UniqueName="Username" DataType="System.String" >
                    </telerik:GridBoundColumn>
                    
                     <telerik:GridBoundColumn DataField="Password" 
                        HeaderText="Password"
                        SortExpression="Password" UniqueName="Password">
                    </telerik:GridBoundColumn>
                    
                    <telerik:GridBoundColumn DataField="FullName" 
                        HeaderText="FullName" 
                        SortExpression="FullName" UniqueName="FullName">
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn DataField="Address" 
                        HeaderText="Address" 
                        SortExpression="Address" UniqueName="Address">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Email" 
                        HeaderText="Email" 
                        SortExpression="Email" UniqueName="Email">
                    </telerik:GridBoundColumn>
                    
                    <telerik:GridBoundColumn DataField="Phone" 
                        HeaderText="Phone" 
                        SortExpression="Phone" UniqueName="Phone">
                    </telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="Birthday" HeaderText="Ngày sinh" UniqueName="Birthday">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridCheckBoxColumn DataField="IsAdmin" HeaderText="IsAdmin" UniqueName="IsAdmin">
                    </telerik:GridCheckBoxColumn>
                    
                    
                    <telerik:GridButtonColumn ConfirmText="Delete this Admin?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings ColumnNumber="2" CaptionDataField="Password" CaptionFormatString="Edit properties of Product {0}" InsertCaption="New Product">
                   <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                    <FormCaptionStyle></FormCaptionStyle>
                    <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                        Width="100%" />
                    <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
                    <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                    <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record"
                        UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                    </EditColumn>
                    <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                </EditFormSettings>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick" />
            </ClientSettings>
        </telerik:RadGrid>
        
        
        <asp:SqlDataSource ID="SessionDataSource1" runat="server" 
           ConnectionString="<%$ ConnectionStrings:QLMTConnectionString %>" ProviderName="System.Data.SqlClient"
           SelectCommand="SELECT * FROM [Admin1]"
            DeleteCommand="DELETE FROM [Admin1] WHERE [Username] = @original_Username" 
            InsertCommand="INSERT INTO Admin1(Username, Password,FullName,Address, Email,Phone,Birthday,IsAdmin) VALUES (@Username, @Password,@FullName,@Address, @Email,@Phone,@Birthday,@IsAdmin)"
            UpdateCommand="UPDATE [Admin1] SET  [Password] = @Password, [FullName] = @FullName,[Address]=@Address, [Email] = @Email, [Phone] = @Phone,[Birthday]=@Birthday,[IsAdmin]=@IsAdmin WHERE [Username] = @original_Username "
            
           OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
          
           
           <DeleteParameters>
                <asp:Parameter Name="original_Username" Type="String" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="FullName" Type="String" />
                <asp:Parameter Name="Address" Type="String" />                
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Phone" Type="String" />
                <asp:Parameter Name="Birthday" Type="DateTime" />
                <asp:Parameter Name="IsAdmin" Type="Boolean" />
                
                <asp:Parameter Name="original_Username" Type="String" />
                
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="Username" Type="String" />
                <asp:Parameter Name="Password" Type="String" />
                <asp:Parameter Name="FullName" Type="String" />
                <asp:Parameter Name="Address" Type="String" />                
                <asp:Parameter Name="Email" Type="String" />
                <asp:Parameter Name="Phone" Type="String" />
                <asp:Parameter Name="Birthday" Type="DateTime" />
                <asp:Parameter Name="IsAdmin" Type="Boolean" />
               
            </InsertParameters>
           
       </asp:SqlDataSource>
        
        
        
       
       
            
        <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="200px" />
        <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="150px" />
        <telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" DropDownStyle-Width="110px" />
        <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" />
     
        
        <br />
       
</asp:Content>

